import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayRateVO, PayRateForm, PayRateQuery } from '@/api/system/PayRate/types';

/**
 * 查询汇率列表
 * @param query
 * @returns {*}
 */

export const listPayRate = (query?: PayRateQuery): AxiosPromise<PayRateVO[]> => {
  return request({
    url: '/system/PayRate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询汇率详细
 * @param rateId
 */
export const getPayRate = (rateId: string | number): AxiosPromise<PayRateVO> => {
  return request({
    url: '/system/PayRate/' + rateId,
    method: 'get'
  });
};

/**
 * 新增汇率
 * @param data
 */
export const addPayRate = (data: PayRateForm) => {
  return request({
    url: '/system/PayRate',
    method: 'post',
    data: data
  });
};

/**
 * 修改汇率
 * @param data
 */
export const updatePayRate = (data: PayRateForm) => {
  return request({
    url: '/system/PayRate',
    method: 'put',
    data: data
  });
};

/**
 * 删除汇率
 * @param rateId
 */
export const delPayRate = (rateId: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayRate/' + rateId,
    method: 'delete'
  });
};
